Creates a directory (folder) with a given name.

Paste the code into the body of your document and call the makedir(newname) function. Change the written statements as you like.

====================================================

<?php
function makedir($newname) {
  //The function
  if (!file_exists($newname)) {
    //If there isn't already a directory there
    if (mkdir($newname)) {
      //If we made the directory
      echo "Directory $newname was created";
    }  else {
      echo "ERROR: Directory $newname could not be created";
    }
  } else {
    echo "ERROR: Directory $newname already exists";
  }
}
?>